﻿//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
// Exo² samples - Test
// Copyright (C) 2007-2009 Samuel Lacroix and Raphaël Legouge
//
// Distributed under GNU General Public License
// See the License folder of Exo² for details
//
//
// http://www.codeplex.com/exo2 (eng)
//-----------------------------------------------------------------------------
#ifndef TEST_H
#define TEST_H


#include "tester.h"


#define USE_RBS


class CTest : public Exo2::CApplication
{
    public:
    // Construction / destruction    
        CTest();
        ~CTest() {}
        
        scoped_ptr<Exo2::CSpriteText> pTestText;
        
    private:
    // Caméra
        shared_ptr<Exo2::CBaseCamera> pCam;
        float speed;
        float CamYaw;                
        float CamPitch;
        float CamRoll;

    // Actions caméra
        /*
        shared_ptr<Exo2::Action> CamNewYawPos;
        shared_ptr<Exo2::Action> CamNewYawNeg;
        shared_ptr<Exo2::Action> CamNewPitchPos;
        shared_ptr<Exo2::Action> CamNewPitchNeg;
        shared_ptr<Exo2::Action> CamNewRollPos;
        shared_ptr<Exo2::Action> CamNewRollNeg;
        shared_ptr<Exo2::Action> CamStrafeLeft;
        shared_ptr<Exo2::Action> CamStrafeRight;
        shared_ptr<Exo2::Action> CamForward;
        shared_ptr<Exo2::Action> CamBack;
        shared_ptr<Exo2::Action> CamUp;
        shared_ptr<Exo2::Action> CamDown;
        */

    // Fonctions de Test d'Exo²
        void CreateExoTest();                   
        void UpdateExoTest(float ElapsedTime, double TotalTime);
        void RenderExoTest() const;
        void DestroyExoTest();                  

    // Audio
        void AudioTestCreate();
        void AudioTestUpdate(float ElapsedTime, double TotalTime);
        void AudioTestDestroy();
        scoped_ptr<Exo2::CAudioDevice> pAudioDevice;
        scoped_ptr<Exo2::CStreamer> pStreamer;
        scoped_ptr<Exo2::CStreamSource> pStreamSource;
        scoped_ptr<Exo2::CSampleSource> pSampleSource;
        scoped_ptr<Exo2::CSampleSource> pSampleSource2;
        
    // Physics
        void PhysicsTestCreate();
        void PhysicsTestUpdate(float ElapsedTime, double TotalTime);
        void PhysicsTestRender() const;
        void PhysicsTestDestroy();
        scoped_ptr<Exo2::CPhysicalEngine> pPhysicsEngine;
        shared_ptr<Exo2::CWorldEntity> pWorld;
        shared_ptr<Exo2::CParticleEmitter> pEmitter;
        static const double EmitterRotationSpeed;
        scoped_ptr<Exo2::CRenderBatchingSystem> pRBS;
        scoped_ptr<Exo2::CParticleSystem> pParticleRenderer;
        shared_ptr<Exo2::CMesh> pWorldMesh;
        static const float PhysicsTestParticleSize;        
        static const D3DXCOLOR PhysicsTestParticleColor;
        struct CTestEntity
        {
                shared_ptr<Exo2::CEntity> pPhysicalEntity;
                shared_ptr<Exo2::CMesh> pGraphicalEntity;
        };
        typedef std::vector<CTestEntity> TTestEntities;
        TTestEntities TestEntities;
        static const size_t TestEntityNumber = 1;
        shared_ptr<Exo2::CCustomEntityConstraint1> pConstraint;

        IDirect3DDevice9* pDev;
        void RegisterConfigProperties();
        void RegisterGameActions();
        void DeviceCreated();
        void DeviceDestroyed();
        void DeviceReset(); 
        void DeviceLost();
        void OnCreated();
        void OnDestroying();
        void Update(double TotalTime, float ElapsedTime);
        void Render3D() const;
        void Render2D() const;
        LPCTSTR GetAppGUID() const { return _T("{45CC90E7-CBA6-4216-854C-0184F671D46A}"); }             // Généré le dimanche 15 février 2009 17:56:54
};
 

#endif